package lesson1;

import java.io.IOException;

public class Hero  {
    private String name;
    private Weapon weapon;

    public Hero(){}

    public Hero(String name,Weapon weapon){
        this.name = name;
        this.weapon = weapon;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Weapon getWeapon() {
        return weapon;
    }

    @Inject
    public void setWeapon(Weapon weapon){
        this.weapon = weapon;
    }

    public void fight(){
        System.out.println(name + "开始攻击");
        weapon.attck();
    }


}
